<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="./img/asset-favicon.ico">
    <title>社交-提交问题页</title>

    <!-- 页面 css js -->
    <link rel="stylesheet" type="text/css" href="./plugins/normalize-css/normalize.css" />
    <link rel="stylesheet" type="text/css" href="./plugins/yui/cssgrids-min.css" />
    <link rel="stylesheet" type="text/css" href="./plugins/sui/sui.min.css" />
    <link rel="stylesheet" type="text/css" href="./plugins/sui/sui-append.min.css" />
    <link rel="stylesheet" type="text/css" href="./plugins/font-awesome/css/font-awesome.min.css" />
    <link rel="stylesheet" type="text/css" href="./css/widget-base.css" />
    <link rel="stylesheet" type="text/css" href="./css/widget-head-foot.css" />
    <link rel="stylesheet" type="text/css" href="./css/page-sj-qa-submit.css" />
    <link rel="stylesheet" href="./css/element.css">
</head>

<body>
    <div class="wrapper">
        <header>
        </header>
    </div>

    <div class="wrapper">
        <!--引用组件-->
        <!--头部导航-->
        <div class="qa-submit-form">
            <form action="" class="sui-form">
                <div class="input-title">
                    <input type="text" placeholder="标题：一句话说清问题，用问号结尾" class="input-xfat input-xxlarge title" id="qa_title">
                </div>
                <div class="tags-area">
                    <div class="input-tags">
                        <input type="text" style="width:100%" disabled placeholder="点击选择标签" autocomplete="off" class="input-xfat input-xxlarge" id="tags">
                    </div>
                    <div class="tags-box">
                        <ul class="sui-tag tag-bordered" id="label_container" style="height:auto;margin-bottom:0">
                        </ul>
                    </div>
                </div>

                <div class="editor">
                    <textarea name="editor2"></textarea>
                </div>
                <div class="submit" id="app">
                    <span>
                        <a class="sui-btn btn-release" @click="publish_qa">发布问题</a>
                    </span>
                </div>
                <div class="clearfix"></div>
            </form>
        </div>
    </div>

    <div class="footer">
        <div class="wrapper">
            <div class="footer-bottom">
                <div class="link">
                    <dl>
                        <dt>网站相关</dt>
                        <dd>关于我们</dd>
                        <dd>服务条款</dd>
                        <dd>帮助中心</dd>
                        <dd>编辑器语法</dd>
                    </dl>
                    <dl>
                        <dt>常用链接</dt>
                        <dd>传智播客</dd>
                        <dd>传智论坛</dd>
                    </dl>
                    <dl>
                        <dt>联系我们</dt>
                        <dd>联系我们</dd>
                        <dd>加入我们</dd>
                        <dd>建议反馈</dd>
                    </dl>
                    <dl>
                        <dt>关注我们</dt>
                        <dd>微博</dd>
                        <dd>twitter</dd>
                    </dl>

                    <div class="xuke">
                        <h3>内容许可</h3>
                        <p>除特别说明外，用户内容均采用知识共享署名-非商业性使用-禁止演绎4.0 国际许可协议 (CC BY-NC-ND 4.0) 进行许可</p>
                        <p>本站由 传智研究院 提供更新服务</p>
                    </div>
                </div>


                <p class="Copyright">Copyright © 2017 传智问答社区 当前版本 0.0.1</p>
            </div>
        </div>

    </div>

    <script>
    </script>


</body>
<script src="./plugins/ckeditor/ckeditor.js"></script>
<script src="js/host.js"></script>
<script src="js/vue.min.js"></script>
<script src="js/element.js"></script>
<script src="js/axios.min.js"></script>
<script src="js/qa_submit.js"></script>
<script>
    CKEDITOR.replace('editor2');
    var ulContainer = document.querySelector('#label_container');
    var idTags = document.querySelector('#tags');
    var url = host + 'labels/'
    var chooseIds = [];
    var chooseName = [];
    axios.get(url).then(response => {

        var hotTagList = response.data;
        var html_str = '';
        for (var i = 0; i < hotTagList.length; i++) {
            html_str += '<li class="tag-item" data-label-id="' + hotTagList[i].id + '">' + hotTagList[i].label_name + '</li>'
        }
        ulContainer.innerHTML = html_str;
        var lis = document.querySelectorAll('.tag-item')
        for (var i = 0; i < lis.length; i++) {
            lis[i].onclick = function () {
                var clickedId = parseInt(this.getAttribute('data-label-id'));
                var clickedName = this.innerHTML;
                var tempIndex = chooseIds.indexOf(clickedId);
                if (tempIndex == -1) {
                    chooseIds.push(clickedId);
                    chooseName.push(clickedName)
                } else {
                    chooseIds.splice(tempIndex, 1);
                    chooseName.splice(tempIndex, 1)

                }
                idTags.value = chooseName.join(" ")
            }
        }
    }).catch(error => { });
    var tags_box = document.querySelector('.tags-box');
    var tags_area = document.querySelector('.tags-area');
    tags_area.onmouseover = function () {
        tags_box.style.display = 'block';
    }
    tags_box.onmouseout = function () {
        tags_box.style.display = 'none';
    }

</script>